﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">

        function removeAd() {
            var floatAdCount = 0;
            var divs = document.getElementsByTagName('div');
            if (divs) {
                for (var i = divs.length - 1; i >= 0; i--) {
                    var zIndex = window.getComputedStyle(divs[i], null).getPropertyValue('z-index');
                    if (zIndex > 100) {
                        var node = divs[i];
                        node.parentNode.removeChild(node);
                        floatAdCount++;
                    }
                }
            }
            console.log(floatAdCount);

            var bodyMarginLeft = parseInt(window.getComputedStyle(document.body, null).getPropertyValue('margin-left'));
            var bodyMarginRight = parseInt(window.getComputedStyle(document.body, null).getPropertyValue('margin-right'));
            var rootAdCount = 0;
            for (var i = document.body.childNodes.length - 1; i >= 0; i--) {
                var node = document.body.childNodes[i];
                if (node.tagName == 'DIV') {
                    var nodeMarginLeft = parseInt(window.getComputedStyle(node, null).getPropertyValue('left'));
                    var nodeWidth = parseInt(window.getComputedStyle(node, null).getPropertyValue('width'));
                    var nodeMarginRight = parseInt(window.getComputedStyle(node, null).getPropertyValue('margin-right'));
                    if (nodeMarginLeft + nodeWidth < bodyMarginLeft || nodeMarginRight + nodeWidth < bodyMarginRight) {
                        try {
                            node.parentNode.removeChild(node);
                            rootAdCount++;
                        } catch (e) { };
                    }
                }
            }
            console.log(rootAdCount);
        }         
    </script>
</head>
<body>
</body>
</html>
